<?php

class Administration_Model_Role extends Zend_Db_Table_Abstract
{
    protected $_name = "role";
    
    
    
    function getGeustRoleName(){
        return (string)'guest';
    }
    
    function getAdminRoleId(){
        $select = $this->select()->where("name = ?","admin");
        return $this->fetchAll($select);
    }
    
    function getRoleByID($roleId){
        return $this->find($roleId)->toArray();
    }
    
    
    function listRoles() {
        return $this->fetchAll()->toArray();        
    }
    
    function addRole($roleName){
        $row = $this->createRow();
        $row->name= $roleName;
        return $row->save();
    }
    
    function editRole($roleId, $roleName){
        
         return $this->update(array("name"=>$roleName), "id = $roleId");
    }
    
    function deleteRole($roleId) {
        return $this->delete("id = $roleId");      
    }



}

